﻿
GO
/****** Object:  Table [dbo].[Settings]    Script Date: 09/03/2008 22:13:08 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Settings](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[Name] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Value] [varchar](500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
/****** Object:  Table [dbo].[Market]    Script Date: 08/01/2008 07:15:43 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Market](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[Name] [varchar](250) NOT NULL,
	[Code] [varchar](50) NULL,
PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Ticker]    Script Date: 08/01/2008 07:15:52 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Ticker](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[Symbol] [varchar](150) NULL,
	[IndustryId] [int] NULL,
	[MarketId] [int] NULL,
	[Name] [varchar](250) NULL,
PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[MarketDay]    Script Date: 08/01/2008 07:15:46 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MarketDay](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[Date] [datetime] NOT NULL,
	[MarketId] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Sector]    Script Date: 08/01/2008 07:15:48 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Sector](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[Name] [varchar](150) NULL,
	[MarketId] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[DailyDetail]    Script Date: 08/01/2008 07:15:18 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DailyDetail](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[TickerId] [int] NULL,
	[MarketDayId] [int] NULL,
	[Per] [nchar](10) NULL,
	[Date] [datetime] NOT NULL,
	[Low] [float] NULL,
	[Oi] [float] NULL,
	[High] [float] NULL,
	[Vol] [float] NULL,
	[Open] [float] NULL,
	[Close] [float] NULL,
 CONSTRAINT [PK__DailyDetail__7C8480AE] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Industry]    Script Date: 08/01/2008 07:15:41 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Industry](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[Name] [varchar](150) NULL,
	[SectorId] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[DailyStatsPerStock]    Script Date: 08/01/2008 07:15:30 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DailyStatsPerStock](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[DailyDetailId] [int] NOT NULL,
	[_1DPC] [float] NULL,
	[_2DPC] [float] NULL,
	[_5DPC] [float] NULL,
	[_10DPC] [float] NULL,
	[_30DPC] [float] NULL,
	[_90DPC] [float] NULL,
	[_1YPC] [float] NULL,
	[_5DAV] [float] NULL,
	[_10DAV] [float] NULL,
	[_30DAV] [float] NULL,
	[_90DAV] [float] NULL,
	[_1YAV] [float] NULL,
	[P52WH] [float] NULL,
	[P90DH] [float] NULL,
	[P30DH] [float] NULL,
	[P10DH] [float] NULL,
PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Fundamental]    Script Date: 08/01/2008 07:15:38 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Fundamental](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[TickerId] [int] NULL,
	[EPS] [float] NULL,
	[PE] [float] NULL,
	[DIVYield] [float] NULL,
	[Shares] [float] NULL,
	[DPS] [float] NULL,
	[PEG] [float] NULL,
	[Pts] [float] NULL,
	[Ptb] [float] NULL,
	[Date] [datetime] NULL,
PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  ForeignKey [MarketDay_DailyDetail]    Script Date: 08/01/2008 07:15:19 ******/
ALTER TABLE [dbo].[DailyDetail]  WITH CHECK ADD  CONSTRAINT [MarketDay_DailyDetail] FOREIGN KEY([MarketDayId])
REFERENCES [dbo].[MarketDay] ([Id])
GO
ALTER TABLE [dbo].[DailyDetail] CHECK CONSTRAINT [MarketDay_DailyDetail]
GO
/****** Object:  ForeignKey [Ticker_DailyDetail]    Script Date: 08/01/2008 07:15:19 ******/
ALTER TABLE [dbo].[DailyDetail]  WITH CHECK ADD  CONSTRAINT [Ticker_DailyDetail] FOREIGN KEY([TickerId])
REFERENCES [dbo].[Ticker] ([Id])
GO
ALTER TABLE [dbo].[DailyDetail] CHECK CONSTRAINT [Ticker_DailyDetail]
GO
/****** Object:  ForeignKey [DailyDetail_DailyStatsPerStock]    Script Date: 08/01/2008 07:15:30 ******/
ALTER TABLE [dbo].[DailyStatsPerStock]  WITH CHECK ADD  CONSTRAINT [DailyDetail_DailyStatsPerStock] FOREIGN KEY([DailyDetailId])
REFERENCES [dbo].[DailyDetail] ([Id])
GO
ALTER TABLE [dbo].[DailyStatsPerStock] CHECK CONSTRAINT [DailyDetail_DailyStatsPerStock]
GO
/****** Object:  ForeignKey [Ticker_Fundamental]    Script Date: 08/01/2008 07:15:38 ******/
ALTER TABLE [dbo].[Fundamental]  WITH CHECK ADD  CONSTRAINT [Ticker_Fundamental] FOREIGN KEY([TickerId])
REFERENCES [dbo].[Ticker] ([Id])
GO
ALTER TABLE [dbo].[Fundamental] CHECK CONSTRAINT [Ticker_Fundamental]
GO
/****** Object:  ForeignKey [Sector_Industry]    Script Date: 08/01/2008 07:15:41 ******/
ALTER TABLE [dbo].[Industry]  WITH CHECK ADD  CONSTRAINT [Sector_Industry] FOREIGN KEY([SectorId])
REFERENCES [dbo].[Sector] ([Id])
GO
ALTER TABLE [dbo].[Industry] CHECK CONSTRAINT [Sector_Industry]
GO
/****** Object:  ForeignKey [Market_MarketDay]    Script Date: 08/01/2008 07:15:46 ******/
ALTER TABLE [dbo].[MarketDay]  WITH CHECK ADD  CONSTRAINT [Market_MarketDay] FOREIGN KEY([MarketId])
REFERENCES [dbo].[Market] ([Id])
GO
ALTER TABLE [dbo].[MarketDay] CHECK CONSTRAINT [Market_MarketDay]
GO
/****** Object:  ForeignKey [Market_Sector]    Script Date: 08/01/2008 07:15:49 ******/
ALTER TABLE [dbo].[Sector]  WITH CHECK ADD  CONSTRAINT [Market_Sector] FOREIGN KEY([MarketId])
REFERENCES [dbo].[Market] ([Id])
GO
ALTER TABLE [dbo].[Sector] CHECK CONSTRAINT [Market_Sector]
GO
/****** Object:  ForeignKey [Industry_Ticker]    Script Date: 08/01/2008 07:15:53 ******/
ALTER TABLE [dbo].[Ticker]  WITH CHECK ADD  CONSTRAINT [Industry_Ticker] FOREIGN KEY([IndustryId])
REFERENCES [dbo].[Industry] ([Id])
GO
ALTER TABLE [dbo].[Ticker] CHECK CONSTRAINT [Industry_Ticker]
GO
/****** Object:  ForeignKey [Market_Ticker]    Script Date: 08/01/2008 07:15:53 ******/
ALTER TABLE [dbo].[Ticker]  WITH CHECK ADD  CONSTRAINT [Market_Ticker] FOREIGN KEY([MarketId])
REFERENCES [dbo].[Market] ([Id])
GO
ALTER TABLE [dbo].[Ticker] CHECK CONSTRAINT [Market_Ticker]
GO
